package com.ltmall.api.parse;

import com.ltmall.api.entity.JsonCity;

import java.util.ArrayList;
import java.util.List;

public class CityParse {
	
	//城市解析
	public static List<JsonCity> cityListParse(List<?> list) {
		List<JsonCity> cityList = new ArrayList<JsonCity>();
		for (int i = 0; i < list.size(); i++) {
			Object[] obj = (Object[]) list.get(i);
			JsonCity city = new JsonCity();

			city.setProvince((obj[0] == null) ? null : obj[0].toString());
			city.setCity((obj[1] == null) ? null : obj[1].toString());
			city.setCounty((obj[2] == null) ? obj[1].toString() : obj[2].toString());
			cityList.add(city);
		}
		return cityList;
	}
	
}
